var t = require;
var e = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("BootConst"),
    i = t("GameData"),
    s = t("Util"),
    c = t("View"),
    l = t("Platforms"),
    u = t("WatchVideo"),
    p = t("ConfS"),
    f = cc._decorator,
    d = f.ccclass,
    h =
        (f.property,
        (function (t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "diamondAdd"), (e.isMask = !0), (e.zIndex = 4), e;
            }
            return (
                n(e, t),
                (e.prototype.onEnable = function () {
                    Adv_skd.default.instance.showInterstitialAd();
                    var t = this.find("panel/content/curDesc/count"),
                        e = t.getComponent(cc.Label);
                    this.setCurCount = function (t) {
                        e.string = "" + t;
                    };
                    var o = (t = this.find("panel/content/cur/money/count")).getComponent(cc.Label);
                    this.setCurReward = function (t) {
                        o.string = "x" + t;
                    };
                    var n = (t = this.find("panel/content/next/desc/count")).getComponent(cc.Label);
                    this.setNextCount = function (t) {
                        n.string = "" + t;
                    };
                    var r = (t = this.find("panel/content/next/money/text")).getComponent(cc.Label);
                    (this.setNextReward = function (t) {
                        r.string = "x" + t;
                    }),
                        i.default.on("diamondAddTimes", this, this.on_change),
                        this.on_change();
                }),
                (e.prototype.onDisable = function () {
                    i.default.off("diamondAddTimes", this, this.on_change);
                }),
                (e.prototype.on_change = function () {
                    var t = s.isdaycount(i.default.diamondAddTimes);
                    this.setCurCount(t + 1),
                        this.setCurReward(this.get本次能获得的数量()),
                        t < 5
                            ? (this.setNextCount(5), this.setNextReward(p.DatasManager.第5次每日钻石))
                            : (this.setNextCount(10), this.setNextReward(p.DatasManager.第10次每日钻石));
                }),
                (e.prototype.onClick = function (t) {
                    var e = this;
                    switch (t) {
                        case "close":
                            this.hideView();
                            break;
                        case "lookvideo":
                            u.default.show(a.dd.diamondAdd, function () {
                                s.reward(0, e.get本次能获得的数量(), "每日钻石"),
                                    i.default.diamondAddTimes.push(Date.now()),
                                    (i.default.diamondAddTimes = i.default.diamondAddTimes),
                                    l.default.platformCtrl.dd(a.dd.EveryDayDiamonds, {
                                        CountNum: i.default.goldAddTimes.length,
                                        CountNumToday: s.isdaycount(i.default.goldAddTimes),
                                        eventTime: Date.now()
                                    });
                            });
                    }
                }),
                (e.prototype.get本次能获得的数量 = function () {
                    var t = s.isdaycount(i.default.diamondAddTimes) + 1;
                    return 5 == t
                        ? p.DatasManager.第5次每日钻石
                        : 10 == t
                        ? p.DatasManager.第10次每日钻石
                        : p.DatasManager.第n次每日钻石;
                }),
                (e = r([d], e))
            );
        })(c.default));
o.default = h;
